import axios from 'axios'
let token = localStorage.getItem('authorization')
axios.defaults.headers.common['Authorization'] = token;
// /system-api
var baseUrl = '/sys';
/**
 * 区域管理
 */
// 获取完整的地区数据
export const getRegionList = params => axios.get(`${baseUrl}/area/tree`, { params: params });
// 新增地区
export const addRegion = params => axios.post(`${baseUrl}/area/add`, params);
// 修改地区信息
export const updateRegion = params => axios.put(`${baseUrl}/area/update`, params);
// 组件拖拽更新排序
export const updateRegionSort = params => axios.put(`${baseUrl}/area/update/sort-by`, params);
// 删除地区
export const deleteRegion = params => axios.delete(`${baseUrl}/area/delete`, { params: params });
// 获取地区详情
export const getRegionDetails = params => axios.get(`${baseUrl}/area/details`, { params: params });
/**
 * 组织机构管理
 */
// 组织机构新增
export const addOrg = params => axios.post(`${baseUrl}/organize/add`, params);
// 获取组织机构列表
export const getOrgList = params => axios.get(`${baseUrl}/organize/list`, { params: params });
// 组织机构下拉列表
export const getOrgChildList = params => axios.get(`${baseUrl}/organize/child-list`, { params: params });
// 删除地区
export const deleteOrg = params => axios.delete(`${baseUrl}/organize/delete`, { params: params });
// 获取组织机构详细信息
export const getOrgDetails = params => axios.get(`${baseUrl}/organize/details`, { params: params });
// 获取组织机构模糊搜索列表
export const getSearchList = params => axios.get(`${baseUrl}/organize/search-list`, { params: params });
// 更新组织机构
export const updateOrg = params => axios.put(`${baseUrl}/organize/update`, params);
// 通过地区获取树状完整组织列表
export const getOrgTreeList = params => axios.get(`${baseUrl}/organize/tree`, { params: params });

// 获取登录用户地区下拉列表
export const getLoginAreaTreeList = params => axios.get(`${baseUrl}/login-user/power/area`, { params: params });
// 获取组织机构搜索用树状结构 
export const getLoginOrgTreeList = params => axios.get(`${baseUrl}/login-user/power/organize`, { params: params });